home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
359_11
/
patch5.000
/
EMU387_E03.CC
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-11
|
1KB
|
78 lines
#include "emu.h"
#include "rmov.h"
#include "compare.h"
void emu_03()
{
if (empty())
return;
if (modrm > 0277)
{
// fcomp st(i)
if (empty(modrm&7))
{
setcc(SW_C3|SW_C2|SW_C0);
return;
}
int c = compare(st(), st(modrm&7));
st().tag = TW_E;
top++;
int f;
if (c & COMP_NAN)
{
exception(EX_I);
f = SW_C3 | SW_C2 | SW_C0;
}
else
switch (c)
{
case COMP_A_LT_B:
f = SW_C0;
break;
case COMP_A_EQ_B:
f = SW_C3;
break;
case COMP_A_GT_B:
f = 0;
break;
case COMP_NOCOMP:
f = SW_C3 | SW_C2 | SW_C0;
break;
}
setcc(f);
}
else
{
// fcom m32real
reg t;
r_mov((float *)get_modrm(), t);
int c = compare(st(), t);
st().tag = TW_E;
top++;
int f;
if (c & COMP_NAN)
{
exception(EX_I);
f = SW_C3 | SW_C2 | SW_C0;
}
else
switch (c)
{
case COMP_A_LT_B:
f = SW_C0;
break;
case COMP_A_EQ_B:
f = SW_C3;
break;
case COMP_A_GT_B:
f = 0;
break;
case COMP_NOCOMP:
f = SW_C3 | SW_C2 | SW_C0;
break;
}
setcc(f);
}
}